/*
using MyGeneration/Template/NHibernate (c) by Sharp 1.4
based on OHM (alvy77@hotmail.com)
*/
using System;
using System.Collections;
using System.Collections.Generic;

namespace DomainModel
{

	/// <summary>
	/// Isections interface for NHibernate mapped table 'sections'.
	/// </summary>
	public interface Isections
	{
		#region Public Properties
		
		int id
		{
			get ;
			set ;
			  
		}
		
		string code
		{
			get ;
			set ;
			  
		}
		
		string name
		{
			get ;
			set ;
			  
		}
		
		string desc
		{
			get ;
			set ;
			  
		}
		
		int parentid
		{
			get ;
			set ;
			  
		}
		
		string tablename
		{
			get ;
			set ;
			  
		}
		
		short? timerinterval
		{
			get ;
			set ;
			  
		}
		
		string fetchsql
		{
			get ;
			set ;
			  
		}
		
		string displaysql
		{
			get ;
			set ;
			  
		}
		
		string deletesql
		{
			get ;
			set ;
			  
		}
		
		byte? autodelete
		{
			get ;
			set ;
			  
		}
		
		string manageurl
		{
			get ;
			set ;
			  
		}
		
		byte? state
		{
			get ;
			set ;
			  
		}
		
		int? seq
		{
			get ;
			set ;
			  
		}
		
		int? csid
		{
			get ;
			set ;
			  
		}
		
		DateTime addTime
		{
			get ;
			set ;
			  
		}
		
		int? lastOid
		{
			get ;
			set ;
			  
		}
		
		DateTime? lastTime
		{
			get ;
			set ;
			  
		}
		
		bool IsDeleted { get; set; }
		bool IsChanged { get; set; }
		
		#endregion 
	}

	/// <summary>
	/// sections object for NHibernate mapped table 'sections'.
	/// </summary>
	[Serializable]
	public class sections : ICloneable,Isections
	{
		#region Member Variables

		protected int _id;
		protected string _code;
		protected string _name;
		protected string _desc;
		protected int _parentid;
		protected string _tablename;
		protected short? _timerinterval;
		protected string _fetchsql;
		protected string _displaysql;
		protected string _deletesql;
		protected byte? _autodelete;
		protected string _manageurl;
		protected byte? _state;
		protected int? _seq;
		protected int? _csid;
		protected DateTime _addtime;
		protected int? _lastoid;
		protected DateTime? _lasttime;
		protected bool _bIsDeleted;
		protected bool _bIsChanged;
		#endregion
		
		#region Constructors
		public sections() {}
		
		public sections(string pcode, string pname, string pdesc, int pparentid, string ptablename, short? ptimerinterval, string pfetchsql, string pdisplaysql, string pdeletesql, byte? pautodelete, string pmanageurl, byte? pstate, int? pseq, int? pcsid, DateTime paddTime, int? plastOid, DateTime? plastTime)
		{
			this._code = pcode; 
			this._name = pname; 
			this._desc = pdesc; 
			this._parentid = pparentid; 
			this._tablename = ptablename; 
			this._timerinterval = ptimerinterval; 
			this._fetchsql = pfetchsql; 
			this._displaysql = pdisplaysql; 
			this._deletesql = pdeletesql; 
			this._autodelete = pautodelete; 
			this._manageurl = pmanageurl; 
			this._state = pstate; 
			this._seq = pseq; 
			this._csid = pcsid; 
			this._addtime = paddTime; 
			this._lastoid = plastOid; 
			this._lasttime = plastTime; 
		}
		
		public sections(string pcode, string pname, int pparentid)
		{
			this._code = pcode; 
			this._name = pname; 
			this._parentid = pparentid; 
		}
		
		public sections(int pid)
		{
			this._id = pid; 
		}
		
		#endregion
		
		#region Public Properties
		
		public virtual int id
		{
			get { return _id; }
			set { _bIsChanged |= (_id != value); _id = value; }
			
		}
		
		public virtual string code
		{
			get { return _code; }
			set 
			{
			  if (value != null && value.Length > 30)
			    throw new ArgumentOutOfRangeException("code", "code value, cannot contain more than 30 characters");
			  _bIsChanged |= (_code != value); 
			  _code = value; 
			}
			
		}
		
		public virtual string name
		{
			get { return _name; }
			set 
			{
			  if (value != null && value.Length > 200)
			    throw new ArgumentOutOfRangeException("name", "name value, cannot contain more than 200 characters");
			  _bIsChanged |= (_name != value); 
			  _name = value; 
			}
			
		}
		
		public virtual string desc
		{
			get { return _desc; }
			set 
			{
			  if (value != null && value.Length > 500)
			    throw new ArgumentOutOfRangeException("desc", "desc value, cannot contain more than 500 characters");
			  _bIsChanged |= (_desc != value); 
			  _desc = value; 
			}
			
		}
		
		public virtual int parentid
		{
			get { return _parentid; }
			set { _bIsChanged |= (_parentid != value); _parentid = value; }
			
		}
		
		public virtual string tablename
		{
			get { return _tablename; }
			set 
			{
			  if (value != null && value.Length > 30)
			    throw new ArgumentOutOfRangeException("tablename", "tablename value, cannot contain more than 30 characters");
			  _bIsChanged |= (_tablename != value); 
			  _tablename = value; 
			}
			
		}
		
		public virtual short? timerinterval
		{
			get { return _timerinterval; }
			set { _bIsChanged |= (_timerinterval != value); _timerinterval = value; }
			
		}
		
		public virtual string fetchsql
		{
			get { return _fetchsql; }
			set 
			{
			  if (value != null && value.Length > 1000)
			    throw new ArgumentOutOfRangeException("fetchsql", "fetchsql value, cannot contain more than 1000 characters");
			  _bIsChanged |= (_fetchsql != value); 
			  _fetchsql = value; 
			}
			
		}
		
		public virtual string displaysql
		{
			get { return _displaysql; }
			set 
			{
			  if (value != null && value.Length > 1000)
			    throw new ArgumentOutOfRangeException("displaysql", "displaysql value, cannot contain more than 1000 characters");
			  _bIsChanged |= (_displaysql != value); 
			  _displaysql = value; 
			}
			
		}
		
		public virtual string deletesql
		{
			get { return _deletesql; }
			set 
			{
			  if (value != null && value.Length > 1000)
			    throw new ArgumentOutOfRangeException("deletesql", "deletesql value, cannot contain more than 1000 characters");
			  _bIsChanged |= (_deletesql != value); 
			  _deletesql = value; 
			}
			
		}
		
		public virtual byte? autodelete
		{
			get { return _autodelete; }
			set { _bIsChanged |= (_autodelete != value); _autodelete = value; }
			
		}
		
		public virtual string manageurl
		{
			get { return _manageurl; }
			set 
			{
			  if (value != null && value.Length > 200)
			    throw new ArgumentOutOfRangeException("manageurl", "manageurl value, cannot contain more than 200 characters");
			  _bIsChanged |= (_manageurl != value); 
			  _manageurl = value; 
			}
			
		}
		
		public virtual byte? state
		{
			get { return _state; }
			set { _bIsChanged |= (_state != value); _state = value; }
			
		}
		
		public virtual int? seq
		{
			get { return _seq; }
			set { _bIsChanged |= (_seq != value); _seq = value; }
			
		}
		
		public virtual int? csid
		{
			get { return _csid; }
			set { _bIsChanged |= (_csid != value); _csid = value; }
			
		}
		
		public virtual DateTime addTime
		{
			get { return _addtime; }
			set { _bIsChanged |= (_addtime != value); _addtime = value; }
			
		}
		
		public virtual int? lastOid
		{
			get { return _lastoid; }
			set { _bIsChanged |= (_lastoid != value); _lastoid = value; }
			
		}
		
		public virtual DateTime? lastTime
		{
			get { return _lasttime; }
			set { _bIsChanged |= (_lasttime != value); _lasttime = value; }
			
		}
		

		public virtual bool IsDeleted
		{
			get
			{
				return _bIsDeleted;
			}
			set
			{
				_bIsDeleted = value;
			}
		}
		
		public virtual bool IsChanged
		{
			get
			{
				return _bIsChanged;
			}
			set
			{
				_bIsChanged = value;
			}
		}
		
		#endregion 
		
		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			sections castObj = null;
			try
			{
				castObj = (sections)obj;
			} catch(Exception) { return false; } 
			return ( castObj != null ) &&
				( this._id == castObj.id );
		}
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
		  
			
			int hash = 57; 
			hash = 27 * hash * _id.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region ICloneable methods
		
		public virtual object Clone()
		{
			return this.MemberwiseClone();
		}
		
		#endregion
	}
	
	#region Custom ICollection interface for sections 

	
	public interface IsectionsCollection : ICollection
	{
		sections this[int index]{	get; set; }
		void Add(sections psections);
		void Clear();
	}
	
	[Serializable]
	public class sectionsCollection : IsectionsCollection
	{
		private IList<sections> _arrayInternal;

		public sectionsCollection()
		{
			_arrayInternal = new List<sections>();
		}
		
		public sectionsCollection( IList<sections> pSource )
		{
			_arrayInternal = pSource;
			if(_arrayInternal == null)
			{
				_arrayInternal = new List<sections>();
			}
		}

		public sections this[int index]
		{
			get
			{
				return _arrayInternal[index];
			}
			set
			{
				_arrayInternal[index] = value;
			}
		}

		public int Count { get { return _arrayInternal.Count; } }
		public bool IsSynchronized { get { return false; } }
		public object SyncRoot { get { return _arrayInternal; } }
		public void CopyTo(Array array, int index){ _arrayInternal.CopyTo((sections[])array, index); }
		public IEnumerator GetEnumerator() { return _arrayInternal.GetEnumerator(); }
		public void Add(sections psections) { _arrayInternal.Add(psections); }
		public void Clear() { _arrayInternal.Clear(); }
		public IList<sections> GetList() { return _arrayInternal; }
	 }
	
	#endregion
}
